<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>hsm-statechart: hsm/hsm_machine.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="hsm-statechart.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">hsm-statechart
   &#160;<span id="projectnumber">0.5</span>
   </div>
   <div id="projectbrief">An easy to use hierarchical state machine for C and C++</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.1.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('hsm__machine_8h.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">hsm_machine.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="hsm__machine_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;<span class="preprocessor">#pragma once</span></div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#ifndef __HSM_MACHINE_H__</span></div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define __HSM_MACHINE_H__</span></div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="hsm__info_8h.html" title="Callbacks for listening to internal statemachine processing.">hsm_info.h</a>&quot;</span></div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="hsm__stack_8h.html" title="Internal stack manipulation routines used by hsm_machine for managing per state instance data...">hsm_stack.h</a>&quot;</span></div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="hsm__state_8h.html" title="Macros and typedefs used for declaring states.">hsm_state.h</a>&quot;</span></div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="hsm__status_8h.html" title="Structure used for consolidating callback parameters.">hsm_status.h</a>&quot;</span></div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;</div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="hsm__machine_8h.html#structhsm__machine__rec" title="The statemachine object.">hsm_machine_rec</a> <a class="code" href="hsm__machine_8h.html#structhsm__machine__rec" title="The statemachine object.">hsm_machine_t</a>;</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="hsm__machine_8h.html#structhsm__context__machine__rec" title="Extends hsm_machine_rec with a context stack to provide per-state instance data.">hsm_context_machine_rec</a> <a class="code" href="hsm__machine_8h.html#structhsm__context__machine__rec" title="Extends hsm_machine_rec with a context stack to provide per-state instance data.">hsm_context_machine_t</a>;</div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;</div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;<span class="comment">// give the lower 16 to user flags</span></div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;<span class="preprocessor">#define HSM_FLAGS_CTX      (1&lt;&lt;16)   // is the machine a context machine</span></div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define HSM_FLAGS_HULA     (1&lt;&lt;17)   // is the machine a hula machine</span></div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;<span class="preprocessor"></span><span class="comment">//#define HSM_FLAGS_INFO   (1&lt;&lt;17)   // flags per thing to log?</span></div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;<span class="comment">//#define HSM_FLAGS_REGION (1&lt;&lt;18)</span></div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;<span class="comment">//---------------------------------------------------------------------------</span></div>
<div class="line"><a name="l00064"></a><span class="lineno"><a class="code" href="hsm__machine_8h.html">   64</a></span>&#160;<span class="comment"></span><span class="keyword">struct </span><a class="code" href="hsm__machine_8h.html#structhsm__machine__rec" title="The statemachine object.">hsm_machine_rec</a></div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;{</div>
<div class="line"><a name="l00069"></a><span class="lineno"><a class="code" href="hsm__machine_8h.html#ae2338fb3d7fccbba312f3151d75cef88">   69</a></span>&#160;    <a class="code" href="hsm__types_8h.html#a5041728bd5890050e49ba4506a83f86f" title="32 bit unsigned integer">hsm_uint32</a> <a class="code" href="hsm__machine_8h.html#ae2338fb3d7fccbba312f3151d75cef88" title="Per state machine flags.">flags</a>;</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;    </div>
<div class="line"><a name="l00075"></a><span class="lineno"><a class="code" href="hsm__machine_8h.html#a043934f01bf682050e4bf098f42a8d66">   75</a></span>&#160;    <a class="code" href="hsm__state_8h.html#structhsm__state__rec" title="a state descriptor http://dev.ionous.net/2012/06/state-descriptors.html">hsm_state</a> <a class="code" href="hsm__machine_8h.html#a043934f01bf682050e4bf098f42a8d66" title="Inner-most state currently active.">current</a>;</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;};</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;</div>
<div class="line"><a name="l00081"></a><span class="lineno"><a class="code" href="hsm__machine_8h.html">   81</a></span>&#160;<span class="keyword">struct </span><a class="code" href="hsm__machine_8h.html#structhsm__context__machine__rec" title="Extends hsm_machine_rec with a context stack to provide per-state instance data.">hsm_context_machine_rec</a></div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;{</div>
<div class="line"><a name="l00086"></a><span class="lineno"><a class="code" href="hsm__machine_8h.html#a18c2fea85572ea48b12e33a8dcf51c9a">   86</a></span>&#160;    <a class="code" href="hsm__machine_8h.html#structhsm__machine__rec" title="The statemachine object.">hsm_machine_t</a> <a class="code" href="hsm__machine_8h.html#a18c2fea85572ea48b12e33a8dcf51c9a" title="Core machine data.">core</a>;</div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;</div>
<div class="line"><a name="l00091"></a><span class="lineno"><a class="code" href="hsm__machine_8h.html#a241819e3262662e82a7d96795cbb44f2">   91</a></span>&#160;    <a class="code" href="hsm__context_8h.html#structhsm__context__stack__rec" title="Per state machine instance manager of context data.">hsm_context_stack_t</a> <a class="code" href="hsm__machine_8h.html#a241819e3262662e82a7d96795cbb44f2" title="Context stack for tracking optional per-state instance data.">stack</a>;</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;};</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;<span class="comment">//---------------------------------------------------------------------------</span></div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;<span class="comment"></span><a class="code" href="hsm__machine_8h.html#structhsm__machine__rec" title="The statemachine object.">hsm_machine</a> <a class="code" href="hsm__machine_8c.html#a620a775df3ad215e489a9b487245749f" title="Initialize a statemachine to its default values.">HsmMachine</a>( <span class="keyword">struct</span> <a class="code" href="hsm__machine_8h.html#structhsm__machine__rec" title="The statemachine object.">hsm_machine_rec</a>* machine );</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;<a class="code" href="hsm__machine_8h.html#structhsm__machine__rec" title="The statemachine object.">hsm_machine</a> <a class="code" href="hsm__machine_8c.html#ac3c05a1d7215bdf5f9e4132a26dafca2" title="Initialize a statemachine with a context stack to its default values.">HsmMachineWithContext</a>( <span class="keyword">struct</span> <a class="code" href="hsm__machine_8h.html#structhsm__context__machine__rec" title="Extends hsm_machine_rec with a context stack to provide per-state instance data.">hsm_context_machine_rec</a>* machine, <a class="code" href="hsm__context_8h.html#structhsm__context__rec" title="A per state instance context object.">hsm_context</a> ctx );</div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;hsm_bool <a class="code" href="hsm__machine_8c.html#a7117ece3956d53414f80e1a340161f8a" title="Start a machine.">HsmStart</a>( <a class="code" href="hsm__machine_8h.html#structhsm__machine__rec" title="The statemachine object.">hsm_machine</a> hsm, <a class="code" href="hsm__state_8h.html#structhsm__state__rec" title="a state descriptor http://dev.ionous.net/2012/06/state-descriptors.html">hsm_state</a> state );</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;</div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;hsm_bool <a class="code" href="hsm__machine_8c.html#a2e5511e0812b7613e3d1e496908bc8d0" title="Send the passed event to the machine.">HsmSignalEvent</a>( <a class="code" href="hsm__machine_8h.html#structhsm__machine__rec" title="The statemachine object.">hsm_machine</a> hsm, <a class="code" href="hsm__forwards_8h.html#ab8e8ab8d2eb97eb5cc6331d85262fb76" title="Pointer to an hsm_event_rec.">hsm_event</a> evt );</div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;</div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;hsm_bool <a class="code" href="hsm__machine_8c.html#a893207a7a8345aad604bd01a84ee9eb4" title="Determine if a machine has been started, and has not reached a terminal, nor an error state...">HsmIsRunning</a>( <span class="keyword">const</span> <a class="code" href="hsm__machine_8h.html#structhsm__machine__rec" title="The statemachine object.">hsm_machine</a> hsm );</div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;</div>
<div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;hsm_bool <a class="code" href="hsm__machine_8c.html#a3463ad5a97144c3c652b4f677644bcba" title="Traverses the active state hierarchy to determine if hsm is possibly in the passed state...">HsmIsInState</a>( <span class="keyword">const</span> <a class="code" href="hsm__machine_8h.html#structhsm__machine__rec" title="The statemachine object.">hsm_machine</a> hsm, <a class="code" href="hsm__state_8h.html#structhsm__state__rec" title="a state descriptor http://dev.ionous.net/2012/06/state-descriptors.html">hsm_state</a> state );</div>
<div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;</div>
<div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;<a class="code" href="hsm__state_8h.html#structhsm__state__rec" title="a state descriptor http://dev.ionous.net/2012/06/state-descriptors.html">hsm_state</a> <a class="code" href="hsm__machine_8h.html#a385e51689fbbf6376b00a27029b7f79a" title="A machine in a final state has deliberately killed itself.">HsmStateFinal</a>();</div>
<div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;</div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;<a class="code" href="hsm__state_8h.html#structhsm__state__rec" title="a state descriptor http://dev.ionous.net/2012/06/state-descriptors.html">hsm_state</a> <a class="code" href="hsm__machine_8h.html#a5574ce97f59edf4b77fafabc6ea36e54" title="Token state for when a machine has inadvertently killed itself.">HsmStateError</a>();</div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;</div>
<div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;<a class="code" href="hsm__state_8h.html#structhsm__state__rec" title="a state descriptor http://dev.ionous.net/2012/06/state-descriptors.html">hsm_state</a> <a class="code" href="hsm__machine_8h.html#a3a16509f8bea2bca3f7b3f36525cc243" title="Token state that can be used by event handler functions to indicate the event was handled and no furt...">HsmStateHandled</a>();</div>
<div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;</div>
<div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;<a class="code" href="hsm__state_8h.html#structhsm__state__rec" title="a state descriptor http://dev.ionous.net/2012/06/state-descriptors.html">hsm_state</a> <a class="code" href="hsm__machine_8c.html#a1ba67e8e0edddad002d4f4c44d0e73db" title="Token state for use with the HSM_STATE macros to represent the outer most state.">HsmTopState</a>();</div>
<div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;</div>
<div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;</div>
<div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;<span class="preprocessor">#endif // #ifndef __HSM_MACHINE_H__</span></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_6c36b64852547327283732128225c9d7.html">hsm</a></li><li class="navelem"><a class="el" href="hsm__machine_8h.html">hsm_machine.h</a></li>
    <li class="footer">Generated on Sat Jul 7 2012 22:48:11 for hsm-statechart by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.1.1 </li>
  </ul>
</div>
</body>
</html>
